<?php defined("MAIN_DIR") or die("No direct access");

require_once ADMIN.HEADFILE;
?>
<div align="left">
<h1>Список текстов</h1><?php
$text_query = "select `info_id`,`name` from `info` order by `name`";

$limit = 10;
$text_res = mysql_query($text_query);
$count = mysql_num_rows($text_res);
$page = 1;
if (isset($_GET['page']))
	$page = $_GET['page'];
$max_page = ceil($count/$limit);
if ($max_page == 0)
	$max_page++;
if ($page > $max_page)
	$page = $max_page;
elseif ($page < 1)
	$page = 1;
$start_list = (ceil($page)-1)*$limit;
$text_query .= " limit $start_list,$limit";
$text_res = mysql_query($text_query);
$text_count = mysql_num_rows($text_res);
?>
<table cellpadding="5" cellspacing="0" class='light'>
	<tr id='header'>
		<td width="30px" style="border-bottom:1px gray solid">ID</td>
		<td width="200px" style="border-bottom:1px gray solid">Страница</td>
		<td width="180px" style="border-bottom:1px gray solid">Действия</td>
	</tr><?php
	while ($text_row = mysql_fetch_array($text_res))
	{
		?><tr>
			<td><?php echo $text_row['info_id']?></td>
			<td><?php echo $text_row['name']?></td>
			<td><a href='/admin/site/text/edit/<?php echo $text_row['info_id']?>'>Редактировать</a></td>
		</tr><?php
	}
?></table><?php
$limit = 10;
$count = 17;
require_once APP."pageskin.php";
?>
</div>

<?php require_once ADMIN.FOOTERFILE; ?>